package com.cc.services.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cc.daos.RoleMapper;
import com.cc.models.Power;
import com.cc.models.Role;
import com.cc.services.RoleServiceI;

@Service("roleService")
@Transactional
public class PowerServiceImpl implements RoleServiceI{

	@Autowired
	private RoleMapper roleMapper;
	
	@Override
	public List<Role> findAll() {
		return roleMapper.findAll();
	}

	@Override
	public void saveRole(Role role) {
		if(role.getRoleId()==0)
			roleMapper.addRole(role);
		else
			roleMapper.updateRole(role);
	}

	@Override
	public void delRole(Integer roleId) {
		roleMapper.delRole(roleId);
	}

	@Override
	public List<Role> findByPage(Map<String, Object> params) {
		return roleMapper.findByPage(params);
	}

	@Override
	public int countByParams(Map<String, Object> params) {
		return roleMapper.countByParams(params);
	}

	@Override
	public List<Power> findPowers(Map<String, Object> params) {
		return roleMapper.findPowers(params);
	}

	@Override
	public void savePowers(Map<String, Object> params) {
		roleMapper.findPowers(params);
	}

	
	

}
